'use strict'
class Route {
    constructor() {
        this.login = {} //角色登录后的请求路由
        this.notLogin = {} //角色不需要登录的请求路由
        this.errMap = {} //用于错误提示
    }

    setNotLogin(routeName, func, err) {
        this.notLogin[routeName] = func
        if (err) {
            this.errMap[routeName] = err
        }
    }

    getNotLogin(routeName) {
        return this.notLogin[routeName]
    }

    set(routeName, func, err) {
        this.login[routeName] = func
        if (err) {
            this.errMap[routeName] = err
        }
    }

    get(routeName) {
        return this.login[routeName]
    }

    getAllRoute() {
        let array = []
        for (let a in this.login) {
            array.push(a)
        }

        for (let a in this.notLogin) {
            array.push(a)
        }

        return array
    }
}
let route = new Route()
module.exports = route
